<?php
/**
 * Created by JetBrains PhpStorm.
 * User: vander
 * Date: 5/27/13
 * Time: 12:33 AM
 * To change this template use File | Settings | File Templates.
 */
header('Access-Control-Allow-Origin: *');
///Doc collecitons.json
$collectionFile = "collections.json";
$handle = fopen($collectionFile, "r");
$collectionStr = "";
while(!feof($handle)){
    $collectionStr = $collectionStr . fgets($handle);
}
fclose($handle);

//$collection = json_decode($collectionStr);
//$numberOfBook = count($collection->books);
//for($i = 0; $numberOfBook; $i++){
//    $visible = $collection->books[$i]->visible;
//    if(isset($visible)){
//        if($collection->books[$i]->visible == "false"){
//            unset($collection->books[$i]);
//        }
//    }
//}
//$collectionStr = json_encode($collection);
echo $collectionStr;
?>